package com.learn.scrm;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

/**
 * @author : Yu.Tan
 * @date : 2023/6/19 15:08
 * @desc : **
 */
public class MonthTest {
    public static void main(String[] args) {
        String format = DatePattern.NORM_MONTH_FORMAT.format(new Date());
        System.out.println(format);


        DateTime begin = DateUtil.endOfMonth(DateUtil.offsetMonth(new Date(), -1).toJdkDate());
        String format2 = DatePattern.NORM_DATETIME_FORMAT.format(begin);
        System.out.println(format2);

        DateTime end = DateUtil.beginOfMonth(DateUtil.offsetMonth(new Date(), -3).toJdkDate());
        String format1 = DatePattern.NORM_DATETIME_FORMAT.format(end);
        System.out.println(format1);

        Integer a=101;
        Integer ratio=30;

        BigDecimal total = new BigDecimal(a);
        BigDecimal ratioDecimal = new BigDecimal(ratio);
        System.out.println(ratioDecimal);

        BigDecimal div = NumberUtil.div(ratioDecimal, new BigDecimal(100),2);
        System.out.println(div);

        BigDecimal mul = NumberUtil.mul(total, div).setScale(0, RoundingMode.UP);
        System.out.println(mul);


    }
}
